<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      <h1> {{msg}}</h1>
      <input type="text" v-model='msg'>
      <span> 
          {{tips}} </span>
  </div>
  <script src="./vue.js"></script>
  <script>
    var vm = new Vue({
      el:'#app',
      data:{
          msg:'',
          tips:''
      },
      watch:{
          msg(newVal,oldVal) {
              if(newVal == 'admin') {
                  this.tips = '存在该用户'
              } else {
                  this.tips = '该用户不存在'
              }
          }
      }
     });
  </script>
</body>
</html>
